package com.friday.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.friday.bo.PersonnelBo;
import com.friday.bo.impl.PersonnelBoImpl;

public class AddDepartmentServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int ret = 0;
		
		String depName = request.getParameter("departmentname");
		
		PersonnelBo personnelBo = new PersonnelBoImpl();
		
		try {
			ret = personnelBo.addDepartment(depName, "", "");
			if(ret > 0) response.sendRedirect("GetAllEmployeesServlet.do");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
